package com.tianruan.psychological.common.encoding;

import com.tianruan.psychological.common.utils.encryption.Md5Utils;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @Author: Dong
 * @Email: dong980514280@gmail.com
 * @Create: 2019-11-22 13:21
 * @PS
 */
public class Md5PasswordEncoder implements PasswordEncoder {

    public String encode(CharSequence rawPassword) {
        return Md5Utils.entrypt(rawPassword.toString());
    }

    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return Md5Utils.validate(rawPassword.toString(), encodedPassword);
    }
}
